package com.zt.location.modules.base.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.zt.location.common.utils.PageUtils;
import com.zt.location.common.utils.Query;
import com.zt.location.common.utils.R;
import com.zt.location.modules.base.entity.LimitspeedEntity;
import com.zt.location.modules.base.service.LimitspeedService;




/**
 * 
 * 
 * @author admin
 * @email obj_admin@163.com
 * @date 2019-06-19 18:50:07
 */
@RestController
@RequestMapping("/base/limitspeed")
public class LimitspeedController {
    @Autowired
    private LimitspeedService limitspeedService;

    /**
     * 列表
     */
    @RequestMapping("/qlist") 
    public R qlist(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<LimitspeedEntity> limitspeedList = limitspeedService.queryList(query);
        return R.ok().put("limitspeedList", limitspeedList);
    }
 
    
    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);

        List<LimitspeedEntity> limitspeedList = limitspeedService.queryList(query);
        int total = limitspeedService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(limitspeedList, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
			LimitspeedEntity limitspeed = limitspeedService.queryObject(id);

        return R.ok().put("limitspeed", limitspeed);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody LimitspeedEntity limitspeed){
			limitspeedService.save(limitspeed);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody LimitspeedEntity limitspeed){
			limitspeedService.update(limitspeed);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
			limitspeedService.deleteBatch(ids);

        return R.ok();
    }
	
}
